gtk4.git
5 years agomultiselection: Make constructor transfer full
Matthias Clasen [Sun, 26 Jul 2020 21:25:06 +0000 (17:25 -0400)]
multiselection: Make constructor transfer full

This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Also make the constructor return GtkMultiSelection *.

Update all callers.

5 years agosingleselection: Make constructor transfer full
Matthias Clasen [Sun, 26 Jul 2020 21:16:15 +0000 (17:16 -0400)]
singleselection: Make constructor transfer full

This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.

5 years agonoselection: Make constructor transfer full
Matthias Clasen [Sun, 26 Jul 2020 20:55:43 +0000 (16:55 -0400)]
noselection: Make constructor transfer full

This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.

5 years agotreelistmodel: Make constructor transfer full
Matthias Clasen [Sun, 26 Jul 2020 20:38:53 +0000 (16:38 -0400)]
treelistmodel: Make constructor transfer full

Make gtk_tree_list_model_new() take the root model
as first argument, and make it transfer full, for
consistency with other wrapping list constructors.

Update all callers.

Still missing here: Make the model property writable,
and allow passing NULL in the constructor.

5 years agosortlistmodel: Make constructor transfer full
Matthias Clasen [Sun, 26 Jul 2020 20:25:12 +0000 (16:25 -0400)]
sortlistmodel: Make constructor transfer full

This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.

5 years agofilterlistmodel: Make constructor transfer full
Matthias Clasen [Sun, 26 Jul 2020 19:55:44 +0000 (15:55 -0400)]
filterlistmodel: Make constructor transfer full

This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.

5 years agoslicelistmodel: Make constructor transfer full
Matthias Clasen [Sun, 26 Jul 2020 19:38:15 +0000 (15:38 -0400)]
slicelistmodel: Make constructor transfer full

This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.

5 years agolistlistmodel: Drop item_type
Matthias Clasen [Sun, 26 Jul 2020 18:37:55 +0000 (14:37 -0400)]
listlistmodel: Drop item_type

We are using G_TYPE_OBJECT throughout, so there
is no need for GtkListListModel to do anything else.

Update all callers.

5 years agomaplistmodel: Make constructor transfer full
Matthias Clasen [Sun, 26 Jul 2020 18:20:25 +0000 (14:20 -0400)]
maplistmodel: Make constructor transfer full

This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.

5 years agoflattenlistmodel: Make the constructor transfer full
Matthias Clasen [Sun, 26 Jul 2020 14:53:55 +0000 (10:53 -0400)]
flattenlistmodel: Make the constructor transfer full

This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.

5 years agoMerge branch 'matthiasc/for-master' into 'master'
Matthias Clasen [Sun, 26 Jul 2020 12:00:49 +0000 (12:00 +0000)]
Merge branch 'matthiasc/for-master' into 'master'

overlaylayout: Document minimally

See merge request GNOME/gtk!2285

5 years agooverlaylayout: Document minimally
Matthias Clasen [Sat, 25 Jul 2020 23:02:33 +0000 (19:02 -0400)]
overlaylayout: Document minimally

This layout manager is not reusable, but we
still need to make its layout properties show
up in the docs.

5 years agoMerge branch 'matthiasc/for-master' into 'master'
Matthias Clasen [Sat, 25 Jul 2020 17:30:11 +0000 (17:30 +0000)]
Merge branch 'matthiasc/for-master' into 'master'

Matthiasc/for master

See merge request GNOME/gtk!2284

5 years agogtk: Improve struct packing in places
Matthias Clasen [Sat, 25 Jul 2020 02:57:34 +0000 (22:57 -0400)]
gtk: Improve struct packing in places

Plug some holes in our structs by rearranging
a few fields. This is was done looking at
pahole output.

5 years agogdk: Improve struct packing in places
Matthias Clasen [Sat, 25 Jul 2020 02:57:00 +0000 (22:57 -0400)]
gdk: Improve struct packing in places

Plug some holes in our structs by rearranging
a few fields. This is was done looking at
pahole output.

5 years agocolorswatch: Remove unused radius fields
Matthias Clasen [Sat, 25 Jul 2020 04:31:08 +0000 (00:31 -0400)]
colorswatch: Remove unused radius fields

The radius fields are never used.

5 years agohsla: Just store floats
Matthias Clasen [Sat, 25 Jul 2020 04:29:42 +0000 (00:29 -0400)]
hsla: Just store floats

We are using floats for rgb, and we don't need more precision
for hsl colors either. We use hsl for computing color expressions
like shade(), lighter() and darker(), which are not precisely
specified anyway.

This commit updates the one test where the output changes a
tiny bit due to this.

5 years agoheaderbar: Drop the Private struct
Matthias Clasen [Sat, 25 Jul 2020 11:40:24 +0000 (07:40 -0400)]
headerbar: Drop the Private struct

5 years agocolorplane: Drop the Private struct and padding
Matthias Clasen [Sat, 25 Jul 2020 02:56:24 +0000 (22:56 -0400)]
colorplane: Drop the Private struct and padding

5 years agoMerge branch 'matthiasc/for-master' into 'master'
Matthias Clasen [Sat, 25 Jul 2020 00:05:28 +0000 (00:05 +0000)]
Merge branch 'matthiasc/for-master' into 'master'

Matthiasc/for master

See merge request GNOME/gtk!2283

5 years agoMerge branch 'wip/otte/types' into 'master'
Matthias Clasen [Fri, 24 Jul 2020 23:54:01 +0000 (23:54 +0000)]
Merge branch 'wip/otte/types' into 'master'

Get rid of unneeded glib types

See merge request GNOME/gtk!2282

5 years agoAdd another sortlistmodel test
Matthias Clasen [Fri, 24 Jul 2020 23:28:21 +0000 (19:28 -0400)]
Add another sortlistmodel test

This tests the crash fix in f7b73b2e010960975.

5 years agotestsuite: Add an incremental sort test
Matthias Clasen [Fri, 24 Jul 2020 22:32:01 +0000 (18:32 -0400)]
testsuite: Add an incremental sort test

Add a test that makes changes to a model while it
is incrementally sorted.

5 years agotimsort: Avoid a crash
Matthias Clasen [Fri, 24 Jul 2020 23:22:12 +0000 (19:22 -0400)]
timsort: Avoid a crash

We need to clear the pointer after freeing the data,
since the sortlistmodel keeps its timsort structure
around and reuses it.

5 years agoReplace "gdouble" with "double"
Benjamin Otte [Fri, 24 Jul 2020 20:32:16 +0000 (22:32 +0200)]
Replace "gdouble" with "double"

5 years agoReplace "gfloat" with "float"
Benjamin Otte [Fri, 24 Jul 2020 20:25:56 +0000 (22:25 +0200)]
Replace "gfloat" with "float"

5 years agoReplace "gchar" with "char"
Benjamin Otte [Fri, 24 Jul 2020 18:40:36 +0000 (20:40 +0200)]
Replace "gchar" with "char"

5 years agoReplace "gint" with "int"
Benjamin Otte [Fri, 24 Jul 2020 13:54:49 +0000 (15:54 +0200)]
Replace "gint" with "int"

5 years agotestsuite: Use better names for sortlistmodel tests
Matthias Clasen [Fri, 24 Jul 2020 19:37:49 +0000 (15:37 -0400)]
testsuite: Use better names for sortlistmodel tests

Name the tests for what they do.

5 years agotestsuite: Reenable tests for incremental sort
Matthias Clasen [Fri, 24 Jul 2020 19:22:14 +0000 (15:22 -0400)]
testsuite: Reenable tests for incremental sort

This was unintentionally disabled.

5 years agoMerge branch 'remove-align-widget' into 'master'
Matthias Clasen [Fri, 24 Jul 2020 18:17:30 +0000 (18:17 +0000)]
Merge branch 'remove-align-widget' into 'master'

menubutton: Remove align-widget property

See merge request GNOME/gtk!2280

5 years agosortlistmodel: Fix a crash
Matthias Clasen [Fri, 24 Jul 2020 14:40:55 +0000 (10:40 -0400)]
sortlistmodel: Fix a crash

5 years agodropdown: Fix popup sizing
Matthias Clasen [Fri, 24 Jul 2020 13:07:45 +0000 (09:07 -0400)]
dropdown: Fix popup sizing

Setting a width request is not quite enough, since
gtk_widget_set_size_request() only queues a resize
when the widget is visible. Explicitly force one
here. Without this, the popup sometimes shows up
too small.

5 years agomenubutton: Remove align-widget property
Florian Müllner [Fri, 24 Jul 2020 11:39:38 +0000 (13:39 +0200)]
menubutton: Remove align-widget property

The property has been unused since commit 8701e34f749. That was four
years ago, so it's safe to say that nobody has been missing it terribly.

5 years agoMerge branch 'fix-gdk-array-msvc' into 'master'
Timm Bäder [Fri, 24 Jul 2020 09:28:21 +0000 (09:28 +0000)]
Merge branch 'fix-gdk-array-msvc' into 'master'

gdk/gdkarrayimpl.c: Fix build on Visual Studio

See merge request GNOME/gtk!2279

5 years agogdk/gdkarrayimpl.c: Fix build on Visual Studio
Chun-wei Fan [Fri, 24 Jul 2020 08:25:24 +0000 (16:25 +0800)]
gdk/gdkarrayimpl.c: Fix build on Visual Studio

It seems like initializing something to an empty array using `{}` is a GCCism,
so just stuff a 0 within the braces to accomplish the same thing.

5 years agoMerge branch 'matthiasc/for-master' into 'master'
Matthias Clasen [Fri, 24 Jul 2020 02:58:51 +0000 (02:58 +0000)]
Merge branch 'matthiasc/for-master' into 'master'

filechooser: Remove a leftover signal emission

Closes #2942

See merge request GNOME/gtk!2276

5 years agodocs: Work around escaping bugs
Matthias Clasen [Thu, 23 Jul 2020 20:14:33 +0000 (16:14 -0400)]
docs: Work around escaping bugs

This is truly a russian doll of documentation formats:
a string containing <> inside an xml fragment in an |[ ]|
gtk-doc example in markdown in a doc comment.

Sadly, something gets escaping wrong, so the <> end up
literally in the docbook and mess up the last step of
our document formatting, even after turning them into
entities.

Work around this with an extra level of entities that
really shouldn't be necessary.

5 years agodocs: Pass --standalone to pandoc
Matthias Clasen [Thu, 23 Jul 2020 19:46:06 +0000 (15:46 -0400)]
docs: Pass --standalone to pandoc

This flag causes pandoc to emit a proper doctype
declaration and, crucially, namespace declarations
for the xlink namespace that it insists on using
for href attributes. Without this, putting external
links in md documents doesn't survive the journey
through xml.

5 years agodocs: Improve shortcut trigger docs
Matthias Clasen [Thu, 23 Jul 2020 16:57:08 +0000 (12:57 -0400)]
docs: Improve shortcut trigger docs

Point out the need to escape <> in xml.

5 years agodocs: Explain the shortcutcontroller example a bit
Matthias Clasen [Thu, 23 Jul 2020 16:43:46 +0000 (12:43 -0400)]
docs: Explain the shortcutcontroller example a bit

Add a reference to the the syntax for shortcut actions
in builder files.

5 years agofilechooser: Remove a leftover signal emission
Matthias Clasen [Thu, 23 Jul 2020 11:58:57 +0000 (07:58 -0400)]
filechooser: Remove a leftover signal emission

Commit 0145809a94667c75ed4a4 replace the response-requested
signal with an action, but didn't actually remove the emission
of that no-longer-existing signal.

Fixes: #2942
5 years agoMerge branch 'wip/otte/for-master' into 'master'
Benjamin Otte [Thu, 23 Jul 2020 14:34:33 +0000 (14:34 +0000)]
Merge branch 'wip/otte/for-master' into 'master'

Wip/otte/for master

See merge request GNOME/gtk!2277

5 years agosearchenginemodel: Remove unused code
Benjamin Otte [Thu, 23 Jul 2020 01:35:26 +0000 (03:35 +0200)]
searchenginemodel: Remove unused code

5 years agosearchengine: Remove unused set_recursive() call
Benjamin Otte [Thu, 23 Jul 2020 01:06:42 +0000 (03:06 +0200)]
searchengine: Remove unused set_recursive() call

5 years agoUpdate Romanian translation
Florentina Mușat [Thu, 23 Jul 2020 10:33:16 +0000 (10:33 +0000)]
Update Romanian translation

5 years agoUpdate Romanian translation
Florentina Mușat [Thu, 23 Jul 2020 10:32:08 +0000 (10:32 +0000)]
Update Romanian translation

5 years agoMerge branch 'matthiasc/for-master' into 'master'
Matthias Clasen [Thu, 23 Jul 2020 00:19:15 +0000 (00:19 +0000)]
Merge branch 'matthiasc/for-master' into 'master'

Matthiasc/for master

See merge request GNOME/gtk!2275

5 years agoNEWS: Updates
Matthias Clasen [Wed, 22 Jul 2020 23:51:27 +0000 (19:51 -0400)]
NEWS: Updates

5 years agomigration guide: Add some tables
Matthias Clasen [Wed, 22 Jul 2020 23:38:58 +0000 (19:38 -0400)]
migration guide: Add some tables

Add a table mapping event signals to their event controller
replacements, and a table mapping former GtkContainer
subclasses to their gtk_container_add replacement.

5 years agoMerge branch 'wip/otte/for-master' into 'master'
Benjamin Otte [Wed, 22 Jul 2020 18:08:24 +0000 (18:08 +0000)]
Merge branch 'wip/otte/for-master' into 'master'

timsort: Actually 0-terminate the array in get_runs()

See merge request GNOME/gtk!2274

5 years agotimsort: Actually 0-terminate the array in get_runs()
Benjamin Otte [Wed, 22 Jul 2020 16:59:22 +0000 (18:59 +0200)]
timsort: Actually 0-terminate the array in get_runs()

This could cause SEGVs when changing the sort during an ongoing sort
operation.

5 years agoUpdate Ukrainian translation
Yuri Chornoivan [Wed, 22 Jul 2020 13:27:26 +0000 (13:27 +0000)]
Update Ukrainian translation

5 years agoUpdate Ukrainian translation
Yuri Chornoivan [Wed, 22 Jul 2020 13:22:09 +0000 (13:22 +0000)]
Update Ukrainian translation

5 years agoMerge branch 'wip/otte/sortlistmodel2' into 'master'
Matthias Clasen [Wed, 22 Jul 2020 13:15:45 +0000 (13:15 +0000)]
Merge branch 'wip/otte/sortlistmodel2' into 'master'

Massively refactor and improve sortlistmodel

See merge request GNOME/gtk!2273

5 years agoUpdate POTFILES.in
Piotr Drąg [Wed, 22 Jul 2020 13:01:05 +0000 (15:01 +0200)]
Update POTFILES.in

5 years agogtk-demo: Add a progress bar when the colors demo resorts
Benjamin Otte [Wed, 22 Jul 2020 01:18:33 +0000 (03:18 +0200)]
gtk-demo: Add a progress bar when the colors demo resorts

5 years agosortlistmodel: Add progress estimation
Benjamin Otte [Wed, 22 Jul 2020 00:50:58 +0000 (02:50 +0200)]
sortlistmodel: Add progress estimation

5 years agotimsort: Add progress estimation
Benjamin Otte [Sun, 12 Jul 2020 15:57:03 +0000 (17:57 +0200)]
timsort: Add progress estimation

5 years agosortlistmodel: Make key generation part of the step function
Benjamin Otte [Tue, 21 Jul 2020 23:43:59 +0000 (01:43 +0200)]
sortlistmodel: Make key generation part of the step function

SSave the missing keys as a bitset and iterate over that bitset in the
step function.

Solves the problem with a large UI block at the beginning of a sort
operation when all the keys were generated, in particular when key
generation was slow.

Benchmarks for maximum time taken by a single main loop callback:

     initial sort with complex GFileInfo keys
                       old      new
      32,000 items   137ms      3ms
     128,000 items   520ms     31ms

     initial sort with string keys
                       old      new
      32,000 items   187ms      1ms
     128,000 items   804ms      3ms

5 years agogtk-demo: Make colors demo do incremental sorting
Benjamin Otte [Tue, 21 Jul 2020 23:43:40 +0000 (01:43 +0200)]
gtk-demo: Make colors demo do incremental sorting

5 years agosortlistmodel: Properly compute runs
Benjamin Otte [Tue, 21 Jul 2020 02:50:05 +0000 (04:50 +0200)]
sortlistmodel: Properly compute runs

When updating a (partially) sorted model, take the known runs for the
existing sort and apply them to the new sort. That way, we don't have to
check the whole model again.

Benchmarks:

      appending half the items to a model of strings
                        old      new
      512,000 items   437ms    389ms
    1,024,000 items  1006ms    914ms

      appending 10% of the items to a model of strings
                        old      new
      512,000 items   206ms    132ms
    1,024,000 items   438ms    301ms

      appending 1 item to a model of strings
                        old      new
       64,000 items   1.8ms   0.00ms
      512,000 items     ---   0.01ms

5 years agosortlistmodel: Make sort stable again
Benjamin Otte [Tue, 21 Jul 2020 02:06:13 +0000 (04:06 +0200)]
sortlistmodel: Make sort stable again

Previously, the sort was not stable when items were added/removed while
sorting or the sort algorithm was changed.

Now the sort looks at the item position (via the key's location in the
keys array) to make sure each comparison stays stable with respect to
this position.

5 years agomultisorter: Implement GtkSortKeys
Benjamin Otte [Mon, 20 Jul 2020 20:24:36 +0000 (22:24 +0200)]
multisorter: Implement GtkSortKeys

5 years agotreelistrowsorter: Implement GtkSortKeys
Benjamin Otte [Sun, 19 Jul 2020 02:58:06 +0000 (04:58 +0200)]
treelistrowsorter: Implement GtkSortKeys

5 years agonumericsorter: Implement GtkSortKeys
Benjamin Otte [Thu, 16 Jul 2020 12:03:09 +0000 (14:03 +0200)]
numericsorter: Implement GtkSortKeys

5 years agostringsorter: Implement GtkSortKeys
Benjamin Otte [Wed, 15 Jul 2020 18:28:45 +0000 (20:28 +0200)]
stringsorter: Implement GtkSortKeys

5 years agosortkeys: Add an equal sort keys
Benjamin Otte [Thu, 16 Jul 2020 10:05:45 +0000 (12:05 +0200)]
sortkeys: Add an equal sort keys

Compares every element as equal.
This is useful when sorters are in an invalid configuration.

5 years agosortlistmodel: Use GtkSortKeys
Benjamin Otte [Tue, 21 Jul 2020 01:40:28 +0000 (03:40 +0200)]
sortlistmodel: Use GtkSortKeys

This massively speeds up sorting with expensive sort functions that it's
the most worthwhile optimization of this whole branch.
It's slower for simple sort functions though.

It's also quite a lot slower when the model doesn't support sort keys
(like GtkCustomSorter), but all the other sorters do support keys.

Of course, this depends on the number of items in the model - the number
of comparisons scales O(N * log N) while the overhead for key handling
scales O(N).
So as the log N part grows, generating keys gets more and more
beneficial.

Benchmarks:

       initial sort of a GFileInfo model with display-name keys
                       items     keys
         8,000 items   715ms     50ms
        64,000 items     ---    554ms

       initial sort of a GFileInfo model with complex keys
                       items     keys
        64,000 items   340ms    295ms
       128,000 items   641ms    605ms

       removing half a GFileInfo model with display-name keys
       (no comparisons, just key freeing overhead of a complex sorter)
                       items     keys
       512,000 items    14ms     21ms
     2,048,000 items    40ms     62ms

       removing half a GFileInfo model with complex keys
       (no comparisons, just key freeing overhead of a complex sorter)
                       items     keys
       512,000 items    90ms    237ms
     2,048,000 items   247ms    601ms

5 years agosorter: Introduce GtkSortKeys
Benjamin Otte [Wed, 15 Jul 2020 18:17:55 +0000 (20:17 +0200)]
sorter: Introduce GtkSortKeys

GtkSortKeys is an immutable struct that can be used to manage "sort
keys" for items.

Sort keys are memory that is created specifically for sorting. Because
sorting involves lots of comparisons, it's a good idea to prepare the
data relevant for sorting in advance and sort on that data.

In measurements with a PropertyExpression on a string sorter, it's about
??? faster

5 years agosortlistmodel: Split the SortItem into 2 arrays
Benjamin Otte [Tue, 21 Jul 2020 01:09:10 +0000 (03:09 +0200)]
sortlistmodel: Split the SortItem into 2 arrays

Instead of one item keeping the item + its position and sorting that
list, keep the items in 1 array and put the positions into a 2nd array.

This is generally slower while sorting, but allows multiple improvements:

1. We can replace items with keys
   This allows avoiding multiple slow lookups when using complex
   comparisons

2. We can keep multiple position arrays
   This allows doing a sorting in the background without actually
   emitting items-changed() until the array is completely sorted.

3. The main list tracks the items in the original model
   So only a single memmove() is necessary there, while the old version
   had to upgrade the position in every item.
Benchmarks:

        sorting a model of simple strings
                          old      new
        256,000 items   256ms    268ms
        512,000 items   569ms    638ms

        sorting a model of file trees, directories first, by size
                          old      new
         64,000 items   350ms    364ms
        128,000 items   667ms    691ms

        removing half the model
                          old      new
        512,000 items    24ms     15ms
      1,024,000 items    49ms     25ms

5 years agosortlistmodel: Add an incremental property
Benjamin Otte [Tue, 21 Jul 2020 00:50:45 +0000 (02:50 +0200)]
sortlistmodel: Add an incremental property

Also refactor a large part of the sortmodel to make this convenient.

A large amount of time has been spent on getting items-changed regions
minimized.

5 years agotestsuite: Add exhaustive sortlistmodel test
Benjamin Otte [Sun, 12 Jul 2020 04:53:06 +0000 (06:53 +0200)]
testsuite: Add exhaustive sortlistmodel test

This is basically a copy/paste from the filterlistmodel test, but
adapted for sorting.

5 years agosortlistmodel: Make the sort callback useful
Benjamin Otte [Mon, 20 Jul 2020 23:40:06 +0000 (01:40 +0200)]
sortlistmodel: Make the sort callback useful

1. Run step() for a while to avoid very short steps
   This way, we batch items-changed() emissions.

2. Track the change region accurately
   This way, we can avoid invalidating the whole list if our step just
   touched a small part of a huge list.
   As this is a merge sort, this is a common occurence when we're buys
   merging chunks: The rest of the model outside those chunks isn't
   changed.

Note that the tracking is accurate: It determines the minimum change
region in the model.

This will be important, because the testsuite is going to test this.

5 years agotimsort: Add change tracking to gtk_tim_sort_step()
Benjamin Otte [Sun, 12 Jul 2020 02:20:19 +0000 (04:20 +0200)]
timsort: Add change tracking to gtk_tim_sort_step()

5 years agotimsort: Add gtk_tim_sort_set_max_merge_size()
Benjamin Otte [Sat, 18 Jul 2020 02:45:46 +0000 (04:45 +0200)]
timsort: Add gtk_tim_sort_set_max_merge_size()

Makes the SOrtListModel responsive when incrementally sorting.

By making it configurable we can avoid losting performance in the
non-incremental case.

5 years agotimsort: Make sure merges don't take too long
Benjamin Otte [Sat, 11 Jul 2020 18:34:16 +0000 (20:34 +0200)]
timsort: Make sure merges don't take too long

Limit the size of the merged areas and thereby chunk larger merges into
smaller ones.

5 years agosortlistmodel: Make sorting incremental
Benjamin Otte [Mon, 20 Jul 2020 23:46:09 +0000 (01:46 +0200)]
sortlistmodel: Make sorting incremental

This is just an experiment so far to see how long it takes to sort.

5 years agotimsort: Add gtk_tim_sort_set_runs()
Benjamin Otte [Sat, 11 Jul 2020 04:02:58 +0000 (06:02 +0200)]
timsort: Add gtk_tim_sort_set_runs()

... and use it in the SortListModel

Setting runs allows declaring already sorted regions so the sort does
not attempt to sort them again.

This massively speeds up partial inserts where we can reuse the sorted
model as a run and only resort the newly inserted parts.

Benchmarks:

    appending half the model
                    qsort  timsort
    128,000 items    94ms     69ms
    256,000 items   202ms    143ms
    512,000 items   488ms    328ms

    appending 1 item
                    qsort  timsort
      8,000 items   1.5ms    0.0ms
     16,000 items   3.1ms    0.0ms
              ...
    512,000 items     ---    1.8ms

5 years agosortlistmodel: Use timsort
Benjamin Otte [Fri, 17 Jul 2020 00:47:22 +0000 (02:47 +0200)]
sortlistmodel: Use timsort

Simply replace the old qsort() call with a timsort() call.

This is ultimately relevant because timsort is a LOT faster in merging
to already sorted lists (think items-chaged adding some items) or
reversing an existing list (think columnview sort order changes).

Benchmarks:

    initially sorting the model
                    qsort  timsort
    128,000 items   124ms    111ms
    256,000 items   264ms    250ms

5 years agoAdd a timsort() implementation
Benjamin Otte [Sat, 11 Jul 2020 03:37:31 +0000 (05:37 +0200)]
Add a timsort() implementation

5 years agosortlistmodel: Track item positions
Benjamin Otte [Fri, 17 Jul 2020 00:28:42 +0000 (02:28 +0200)]
sortlistmodel: Track item positions

The model now tracks the original positions on top of just the items so that
it can remove items in an items-changed emission.

It now takes twice as much memory but removes items much faster.

Benchmarks:

Removing 50% of a model:
                   before    after
   250,000 items    135ms     10ms
   500,000 items    300ms     25ms

Removing 1 item:
     4,000 items    2.2ms      0ms
     8,000 items    4.6ms      0ms
   500,000 items      ---   0.01ms

5 years agosortlistmodel: Replace with an array-based model
Benjamin Otte [Thu, 16 Jul 2020 23:56:18 +0000 (01:56 +0200)]
sortlistmodel: Replace with an array-based model

This is the dumbest possible sortmodel using an array:
Just grab all the items, put them in the array, qsort() the array.

Some benchmarks (setting a new model):

  125,000 items - old: 549ms
                  new: 115ms
  250,000 items - new: 250ms

This performance can not be kept for simple additions and removals
though.

5 years agoUpdate Chinese (China) translation
Boyuan Yang [Wed, 22 Jul 2020 02:58:46 +0000 (02:58 +0000)]
Update Chinese (China) translation

5 years agoUpdate Chinese (China) translation
Boyuan Yang [Wed, 22 Jul 2020 02:39:21 +0000 (02:39 +0000)]
Update Chinese (China) translation

5 years agoUpdate Chinese (China) translation
Boyuan Yang [Wed, 22 Jul 2020 02:20:08 +0000 (02:20 +0000)]
Update Chinese (China) translation

5 years agoMerge branch 'wip/chergert/quartz4u' into 'master'
Matthias Clasen [Tue, 21 Jul 2020 22:22:41 +0000 (22:22 +0000)]
Merge branch 'wip/chergert/quartz4u' into 'master'

Merge GDK macOS branch

See merge request GNOME/gtk!2272

5 years agoMerge branch 'matthiasc/for-master' into 'master'
Matthias Clasen [Tue, 21 Jul 2020 21:53:16 +0000 (21:53 +0000)]
Merge branch 'matthiasc/for-master' into 'master'

gdk: Update gdkkeysyms.h

See merge request GNOME/gtk!2271

5 years agomacos: prototype new GDK backend for macOS
Christian Hergert [Thu, 23 Apr 2020 23:36:46 +0000 (16:36 -0700)]
macos: prototype new GDK backend for macOS

This is fairly substantial rewrite of the GDK backend for quartz and
renamed to macOS to allow for a greenfield implementation.

Many things have come across from the quartz implementation fairly
intact such as the eventloop integration design and discovery of
event windows from the NSEvent.

However much has been changed to fit in with the new GDK design and
how removal of child GdkWindow have been completely eliminated.
Furthermore, the new GdkPopup allows for regular NSWindow to be used
to provide popovers unlike the previous implementation.

The object design more closely follows the ideal for a GDK backend.

Views have been broken out into subclasses so that we can support
multiple GSK renderer paths such as GL and Cairo (and Metal in the
future). However mixed mode GL and Cairo will not be supported. Currently
only the Cairo renderer has been implemented.

A new frame clock implementation using CVDisplayLink provides more
accurate information about when to draw drawing the next frame. Some
testing will need to be done here to understand the power implications
of this.

This implementation has also gained edge snapping for CSD windows. Some
work was also done to ensure that CSD windows have opaque regions
registered with the display server.

     ** This is still very much a work-in-progress **

Some outstanding work that needs to be done:

 - Finish a GL context for macOS and alternate NSView for GL rendering
   (possibly using speciailized CALayer for OpenGL).
 - Input rework to ensure that we don't loose remapping of keys that was
   dropped from GDK during GTK 4 development.
 - Make sure input methods continue to work.
 - Drag-n-Drop is still very much a work in progress
 - High resolution input scrolling needs various work in GDK to land
   first before we can plumb that to NSEvent.
 - gtk/ has a number of things based on GDK_WINDOWING_QUARTZ that need
   to be updated to use the macOS backend.

But this is good enough to start playing with and breaking things which
is what I'd like to see.

5 years agogdk: disable file transfer portal on macOS
Christian Hergert [Sat, 18 Jul 2020 01:07:28 +0000 (18:07 -0700)]
gdk: disable file transfer portal on macOS

5 years agobuild: add ATK fallback subproject wrapper
Christian Hergert [Sat, 18 Jul 2020 01:05:14 +0000 (18:05 -0700)]
build: add ATK fallback subproject wrapper

Very similar to the other fallbacks we use.

5 years agobuild: squash various warnings with Clang
Christian Hergert [Sat, 18 Jul 2020 00:59:09 +0000 (17:59 -0700)]
build: squash various warnings with Clang

Otherwise we have really chatty builds that make it difficult to catch
new issues when compiling.

5 years agobuild: fix linking support on macOS with Clang
Christian Hergert [Sat, 18 Jul 2020 00:57:17 +0000 (17:57 -0700)]
build: fix linking support on macOS with Clang

This was preventing any sort of building on macOS, even though the quartz
backend is currently non-functional. Fixing this is a pre-requisite to
getting a new macOS backend compiling.

5 years agogdk: Update gdkkeysyms.h
Matthias Clasen [Tue, 21 Jul 2020 20:55:28 +0000 (16:55 -0400)]
gdk: Update gdkkeysyms.h

Run the gdkkeysyms-update.pl script to pick up several
new keysyms:
GDK_dead_lowline
GDK_dead_aboveverticalline
GDK_dead_belowverticalline
GDK_dead_longsolidusoverlay
GDK_Keyboard
GDK_WWAN
GDK_RFKill
GDK_AudioPreset

5 years agoMerge branch 'matthiasc/for-master' into 'master'
Matthias Clasen [Mon, 20 Jul 2020 22:06:42 +0000 (22:06 +0000)]
Merge branch 'matthiasc/for-master' into 'master'

inspector: Make picking objects show them

Closes #1876

See merge request GNOME/gtk!2269

5 years agoinspector: Make picking objects show them
Matthias Clasen [Mon, 20 Jul 2020 21:30:16 +0000 (17:30 -0400)]
inspector: Make picking objects show them

Changing the selection in the object tree is
not a useful action if we are already in the
object details. Most likely, a user who picks
an object wants to inspect its details, so
just always show them.

Fixes: #1876
5 years agosortlistmodel: Test that the model is stable
Benjamin Otte [Thu, 16 Jul 2020 13:16:30 +0000 (15:16 +0200)]
sortlistmodel: Test that the model is stable

Stability is measured relative to the child model, not relative to the
previous sorter.

5 years agotestsuite: Fix a leak
Benjamin Otte [Sun, 12 Jul 2020 04:46:49 +0000 (06:46 +0200)]
testsuite: Fix a leak

5 years agoMerge branch 'barthalion/asan-runner' into 'master'
Matthias Clasen [Mon, 20 Jul 2020 16:17:49 +0000 (16:17 +0000)]
Merge branch 'barthalion/asan-runner' into 'master'

ci: Switch ASAN tests to runners tagged so

See merge request GNOME/gtk!2267

5 years agoMerge branch 'action-muxer-speedup' into 'master'
Matthias Clasen [Mon, 20 Jul 2020 16:17:17 +0000 (16:17 +0000)]
Merge branch 'action-muxer-speedup' into 'master'

Action muxer speedup

See merge request GNOME/gtk!1754